﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Setup.UC
{
    public partial class Welcome : UserControl
    {
        public Welcome()
        {
            InitializeComponent();
            if (Logic.MainForm == null)
                return;
            InstallInfo info = RegistryLogic.GetEexInfo(Logic.Install.SoftWareKey);

            if (info == null)
            {
                this.buttonInstall.Enabled = true;
            }
            else
            {
                Logic.Install.InstallLocation = info.InstallLocation;
                this.buttonUnInstall.Enabled = true;
                this.buttonUpdate.Enabled = true;
                this.label2.Text = "请的电脑上已完装了" + info.DisplayName;
            }
            label1.Text = "欢迎使用" + Logic.Install.DisplayName + "安装工具";
        }

        private void buttonUpdate_Click(object sender, EventArgs e)
        {
            Logic.MainForm.UpdateExe();
        }

        private void buttonInstall_Click(object sender, EventArgs e)
        {
            Logic.MainForm.Install();
        }

        private void buttonUnInstall_Click(object sender, EventArgs e)
        {
            Logic.MainForm.UnInstall();
        }

        private void buttoncClose_Click(object sender, EventArgs e)
        {
            Logic.MainForm.Cancel();
        }
    }
}
